Skip to content

Add async Always Encrypted crypto utilities (2/5) - #5079

Draft
cheenamalhotra wants to merge 4 commits into
dev/cheena/async-ae-key-cachefrom
dev/cheena/async-ae-crypto-utilities
Draft

cheenamalhotra wants to merge 4 commits into
dev/cheena/async-ae-key-cachefrom
dev/cheena/async-ae-crypto-utilities

Conversation

@cheenamalhotra

Copy link
Copy Markdown
Member

Description

Layer 2/5 split from #4585; depends on #5077. Adds async CEK decryption and CMK signature verification in SqlSecurityUtility, preserving provider selection, candidate fallback, error wrapping, cancellation precedence, and signature-cache publication. The production delta matches source head 5f1b860410426f8c1af3eb55bfac0e7354bd2ac7; newer-main changes remain intact. No call-site wiring or public API changes in this layer.

Includes layer 1's comment-only update at db16a2add7bca13a8e0d31b97aa6bca0a35a5e7c. Retains milestone 8.1.0-preview1.

  • Tests added or updated
  • Public API changes documented (none)
  • Verified against customer repro (not applicable to this isolated layer)
  • Ensure no breaking changes introduced

Issues

Relates to #3672. Split from #4585, which remains untouched. Depends on #5077.

Testing

Relocated the source utility cases to UnitTests/Microsoft/Data/SqlClient/SqlSecurityUtilityTests.cs: 23 methods / 28 cases. Split combined and completion-mode scenarios; added required sections/XML summaries and strengthened final-error assertions. Retained the verification-capable nested provider and metadata helpers. Cache-only tests/providers remain in layer 1.

Passed: 44 tests, zero skipped, in each net10.0 configuration (28 utility + 16 cache cases). Filter discovery was verified; before importing production changes the new tests failed compilation because the async methods were absent.

dotnet test src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj -f net10.0 -c Debug --no-restore --filter 'FullyQualifiedName~SqlSecurityUtilityTests|FullyQualifiedName~SymmetricKeyCacheTests' --blame-hang-timeout 10m
dotnet test src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj -f net10.0 -c Release --no-restore --filter 'FullyQualifiedName~SqlSecurityUtilityTests|FullyQualifiedName~SymmetricKeyCacheTests' --blame-hang-timeout 10m

Passed: net462 builds in Debug and Release, zero warnings/errors.

dotnet build src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj -f net462 -c Debug
dotnet build src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj -f net462 -c Release --no-restore

No SQL Server, AKV, or net462 runtime tests were run on macOS. Command/enclave integration belongs to later layers. Existing unrelated xUnit discovery warnings were not changed.

Guidelines

Please review the contribution guidelines before submitting a pull request:

cheenamalhotra and others added 2 commits November 16, 2026 12:05
Split layer 2 from #4585: decrypt CEKs and verify CMK signatures asynchronously, preserving provider fallback and cancellation behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 16, 2026 19:05
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Nov 16, 2026
@cheenamalhotra cheenamalhotra added this to the 8.1.0-preview1 milestone Nov 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The signature-cache miss/publication path lacks tests proving canceled verification results stay out of the shared cache and uncanceled results are published and reused.

1 open issue
What changed in this PR

Adds the second foundation layer for async Always Encrypted support, building on the async key cache in #5077. Command integration remains deferred to later layers; no public APIs change.

Changes:

  • Adds async column-encryption key decryption with provider selection and candidate fallback.
  • Adds async column-master-key signature verification with cancellation handling and shared-cache publication.
  • Adds unit tests for provider dispatch, fallback, error wrapping, cancellation, and cached signature results.
File Description
src/​Microsoft.Data.SqlClient/​tests/​UnitTests/​Microsoft/​Data/​SqlClient/​SqlSecurityUtilityTests.cs Adds regression coverage for async cryptographic utilities.
src/​Microsoft.Data.SqlClient/​src/​Microsoft/​Data/​SqlClient/​SqlSecurityUtility.cs Adds async key-decryption and signature-verification helpers.

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Required review-policy references were unavailable from a trusted immutable source, preventing verification of repository-specific review gates.

1 open issue

Review effort: Balanced

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.80000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.27%. Comparing base (16919af) to head (c75f65f).

Files with missing lines Patch % Lines
...src/Microsoft/Data/SqlClient/SqlSecurityUtility.cs 96.80% 4 Missing ⚠️
Additional details and impacted files
@@                        Coverage Diff                        @@
##           dev/cheena/async-ae-key-cache    #5079      +/-   ##
=================================================================
+ Coverage                          70.07%   70.27%   +0.19%     
=================================================================
  Files                                314      314              
  Lines                              69893    70018     +125     
=================================================================
+ Hits                               48981    49202     +221     
+ Misses                             20912    20816      -96     
Flag Coverage Δ
sqlclient-pr 70.27% <96.80%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add isolated global-provider coverage for canceled inline and suspended verification results, retry, and positive/negative result reuse.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 16, 2026 20:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Repository-specific review gates remain unverified because no trusted immutable source was established for the required policy references.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

2 participants